const AboutUsModel = require('../db/models/aboutUs');


class AboutUsServer { 
  async addAboutUsData (data) {
    //检查cid是否存在 check cid is existed
    const aid = 1;
    const result = await AboutUsModel.findOne({ where: { aid } });
    //判断 check
    if (result) { 
      //更新 update  
      return await AboutUsModel.update(data, {where: { aid }})
    }else {
      //创建 create
      return await AboutUsModel.create(data);
    }
  }
}

module.exports = new AboutUsServer();